<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>



    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../css/login.css">

</head>

<body>
<div id="app" class="app">
    <!-- 页面头部 -->

    <!-- 页面内容 -->
<!--    <div class="contentBox">-->
<!--        <div class="form-info">-->
            <div class="login-container">
                <div class="loginBox">
            <form class="info-form">
                <div class="input-row">
                    <label>手机号</label>
                    <input v-model="orderInfo.telephone" type="text" class="input-clear" placeholder="请输入手机号">
                    <input style="font-size: x-small;" id="validateCodeButton" @click="sendValidateCode()" type="button" value="发送验证码">
                </div>
                <div class="input-row">
                    <label>验证码</label>
                    <input v-model="orderInfo.validateCode" type="text" class="input-clear" placeholder="请输入验证码">
                </div>
                <div class="input-row">
                    <label>新密码</label>
                    <input v-model="orderInfo.password01" type="password" class="input-clear" placeholder="请输入新密码">
                </div>
                <div class="input-row">
                    <label>确认密码</label>
                    <input v-model="orderInfo.password02" type="password" class="input-clear" placeholder="请确认密码">
                </div>

            <div class="box-button">
                <button @click="submitOrder()" type="button" class="btn order-btn">确认修改</button>
            </div>
            </form>

        </div>
    </div>
</div>

</body>
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            orderInfo: {
            }//预约信息
        },
        methods: {
            //发送验证码
            sendValidateCode() {
                //获取用户输入的手机号
                alert(this.orderInfo.telephone);
                var telephone = this.orderInfo.telephone;
                //发送验证码
                axios.post("/validateCode/send4Order.do?telephone=" + telephone).then((res) => {
                    if (!res.data.flag) {
                        //验证码发送失败
                        this.$message.error("验证码失败,请检查手机号输入是否失败")
                    }
                })
            },
            //提交预约
            submitOrder(){
                //发送ajax请求，提交表单数据到后台进行业务处理
                axios.post("/user/submit.do",this.orderInfo).then((res) => {
                    if(res.data.flag){
                        //预约成功，跳转到成功页面
                        window.location.href = "/success.html" ;
                    }else{
                        //预约失败，提示信息
                        this.$message.error(res.data.message);
                    }
                });
            }
        },
    })

</script>

</html>